/*fixed ie6*/
if($.browser.msie && parseInt($.browser.version)<7){
    try{
        document.execCommand('backgroundImageCache',false,true);
    }catch(e){
    }
}

jQuery.extend({
    Tips:function(opt){
        var st=$.extend({
                type: 'load',   //okay,warn,error,load
                text: '系统繁忙请稍后...',
                time: 3,
                color:{okay:'#080',warn:'#808',error:'#800',load:'#008',stop:'#800',info:'#088'},
                classname:'jquery_tips'
            },opt);
        if($('.'+st.classname).length>0)
            $('.'+st.classname).remove();
            
        var span=$('<span style="float:left;white-space:nowrap;font-size:14px;">'+ st.text +'</span>').appendTo(document.body),
            w=span.width()+65,
            pleft=$(document).scrollLeft()+($(window).width()-w)*.5,
            ptop=$(document).scrollTop()+$(window).height()*.3;
        span.remove();
        var tip = $('<div class="'+ st.classname +'"><span class="right"></span><span class="left"></span><p class="main" style="width:'+(w-19)+'px"><span class="stat '+st.type+'"></span>'+st.text+'</p></div>').css({width:w,left:pleft,top:ptop,color:st.color[st.type]}).appendTo('body');
        if(st.time>0){
            tip.delay((st.time-1)*1000).fadeOut(1000,function(){$(this).remove()});
        }
        return tip;
    },
    hideModal:function () {
        $('#jmodal-overlay').animate({ opacity: 0 }, function() { $(this).css('display', 'none') });
        $('#jquery-jmodal-bg').animate({ opacity: 0 }, function() { $(this).css('display', 'none') });
        $('#jquery-jmodal').animate({ opacity: 0 }, function() { $(this).css('display', 'none') });
    },
    jmodal: function(setting) {
        var ps = $.extend({
            data: {},
            buttonText: 'OK',
            okEvent: function(e) { },
            initWidth: 400,
            marginTop: 100,
            title: 'Sokerr Dialog',
            content: 'This is a jquery plusin!',
            docWidth: $(document).width(),
            docHeight: $(document).height()
        }, setting);
        
        if ($('#jquery-jmodal').length == 0) {
            $(document.body).append('<div id="jmodal-overlay" />' +
                '<div id="jquery-jmodal-bg" />' +
                '<div id="jquery-jmodal">' +
                '<a href="javascript:void(0)" id="jquery-jmodal-close" title="关闭"></a>' +
                '<div id="jmodal-container-title" />' +
                '<div id="jmodal-container-content" />' +
                '<div id="jmodal-container-bottom">' +
                '<a id="jmodal-bottom-okbutton" ></a>' +
                '</div>');
        }
        else {
            $('#jmodal-overlay').css({ opacity: 0, 'display': 'block' });
            $('#jquery-jmodal-bg').css({ opacity: 0, 'display': 'block' });
            $('#jquery-jmodal').css({ opacity: 0, 'display': 'block' });
        }
        $('#jmodal-overlay').css({
            width: ps.docWidth,
            height: ps.docHeight
        }).animate({ opacity: 0.5 });
        $('#jquery-jmodal').css({
            width: ps.initWidth,
            left: (ps.docWidth - ps.initWidth) / 2,
            top: (ps.marginTop + document.documentElement.scrollTop)
        }).animate({ opacity: 1 }, function() {
            var me = this;
            $('#jquery-jmodal-bg').css({
                width: ps.initWidth + 20,
                left: (ps.docWidth - ps.initWidth) / 2 - 10,
                height: $(me).height() + 20,
                opacity: 0.5,
                top: (ps.marginTop - 10 + document.documentElement.scrollTop)
            });
        });
        $('#jquery-jmodal-close').mouseup($.hideModal);
        $('#jmodal-container-title').html(ps.title)
        $('#jmodal-container-bottom')
            .children('#jmodal-bottom-okbutton')
            .text(ps.buttonText)
            .bind('click', function(e) {
                if(ps.okEvent.call($('#jquery-jmodal'),ps.data)!==false){
                    $(this).unbind('click');
                    $.hideModal();
                }
            });
        if (typeof ps.content == 'string') {
            $('#jmodal-container-content').html(ps.content);
        }
        if (typeof ps.content == 'function') {
            var e = $('#jmodal-container-content');
            e.holder = $('#jquery-jmodal');
            e.modalBG = $('#jquery-jmodal-bg');
            ps.content(e);
        }
    },
    lib:{
        //设为首页
        setHome:function(json){
            var url = json ? (json.url ? json.url : window.location.href) : window.location.href;

            if(document.all){
                document.body.style.behavior = 'url(#default#homepage)';
                document.body.setHomePage(url);
            }else if(window.sidebar){
                if(window.netscape){
                    try{
                        netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
                    }catch(e){
                        alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true");
                    }
                }
                var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
                prefs.setCharPref('browser.startup.homepage',url);
            }
        },
        //收藏页面
        addFav:function(json){
            var url = json ? (json.url ? json.url : window.location.href) : window.location.href;
            var title = json ? (json.title ? json.title : document.title) : document.title;
            if(document.all){
                window.external.addFavorite(url,title);
            }else if(window.sidebar){
                window.sidebar.addPanel(title,url,"");
            }else{
                alert('您的浏览器不支持收藏\n请按Ctrl+D手动加入收藏！');
            }
        },
        //返加顶部
        goTop:function(json){
            var id = json ? (json.id ? json.id : "") : "";
            var h = json ? ((parseInt(json.height).toString() != "NaN") ? parseInt(json.height) : 0) : 0;
            if(id!=""){
                $("#"+ id +"").fadeOut(600)
            }
            $('html,body').animate({'scrollTop':0},'fast',function(){
                if(id!="")$("#"+ id +"").fadeIn(600);
            });
        }
    },
    supportPlaceholder:'placeholder' in document.createElement('input'),
    fullScreen:function(){
        if ($.fullScreenApi.supportsFullScreen) {
            if($.fullScreenApi.isFullScreen()){
                $.fullScreenApi.cancelFullScreen();
            }else{
                $.fullScreenApi.requestFullScreen(document.body);
            }
        }
    },
    getSearch:function(str, icase){
        if(str.indexOf('?')==0)str=str.substring(1);
        var rObj={toString:function(){return str;}};
        var strarr=str.split('&');
        var c,k,v;
        for(var i=0;i<strarr.length;i++){
            c=strarr[i].indexOf('=');
            if(c>0){
                k=strarr[i].substring(0,c);
                v=strarr[i].substring(c+1);
            }else{
                k=strarr[i];
                v='';
            }
            if(icase){
                k=k.toLowerCase();
            }
            if(!rObj[k]){
                rObj[k]=v;
            }else{
                if(rObj[k].length === undefined){
                    rObj[k]=[rObj[k]];
                }
                rObj[k].push(v);
            }
        }
        return rObj;
    }
});

jQuery.fn.extend({
    //显示通知在该元素的旁边
    notice:function(set){
        var setup=$.extend({
            msg:$(this).attr('tip')||'请确认此信息',  //显示的提示信息
            autoclose:true,                         //是否自动关闭(对于有focus事件的表单项)
            closebutton:true,                       //是否显示关闭按钮
            alone:true,                             //独立显示,关闭其它通知
            migration:5                             //偏移量
            },$(this).data('notice'),set);          //先从该元素的data-notice中取继承，再继承设定
        
        if(setup.alone)$('.nav-notice').remove();
        
        var tip = $(['<div class="nav-notice">',
        '<div class="arrow" style=""><em>◆</em><span>◆</span></div>',
        '<div class="box"><div class="con-notice"></div></div></div>'].join('\n'));
        
        var con = tip.find('.con-notice');
        con.append(setup.msg);
        
        if(setup.closebutton){
            var closebtn=$('<a class="nav-close" href="javascript:"></a>');
            con.append(closebtn);
            closebtn.click(function(){
                tip.remove();
            });
        }
        
        //定位
        var oft = $(this).offset(),h = $(this).outerHeight();
        tip.css({left:oft.left+setup.migration,top:oft.top+h+setup.migration})
        .appendTo(document.body);
        
        if(setup.autoclose){
            var t=0;
            $(this).focus(function(){
                if(t>1){
                    t = 1;
                    tip.remove();
                }
                t++;
            });
        }
        
        return this;
    },
    jmodal: function(setting) {
        return $(this).each(function(i,obj){
            $(obj).click(function(e){
                e.preventDefault();
                if(setting.onInit){
                    setting.onInit.apply(obj);
                }
                var set=$.extend(setting,$(obj).data('setting'));
                $.jmodal(set);
            });    
        });
    },
    placeHolder:function(){
        if(jQuery.supportPlaceholder)return this;
        return this.each(function(i,o){
            var placeholder = '';
            if (o && (placeholder = o.getAttribute("placeholder"))) {
                o.onfocus = function() {
                    if (this.value === placeholder) {
                        this.value = "";
                    }
                    this.style.color = '';
                };
                o.onblur = function() {
                    if (this.value === "") {
                        this.value = placeholder;
                        this.style.color = 'graytext';
                    }
                };

                if (o.value === "") {
                    o.value = placeholder;
                    o.style.color = 'graytext';
                }

                $(o.form).submit(function(){
                    if(o.value == placeholder){
                        o.value = '';
                    }
                });
            }
        })
    },
    closeNotice:function(){
        $('.nav-notice').remove();
        return this;
    },
    fullScreen:function(){
        if ($.fullScreenApi.supportsFullScreen) {
            if($.fullScreenApi.isFullScreen()){
                $.fullScreenApi.cancelFullScreen();
            }else{
                $.fullScreenApi.requestFullScreen(this[0]);
            }
        }
    },
    validation:function(){
        return this.each(function(i,o){
            verifyForm(o,false);
        });
    },
    editAble:function(options){
        return this.each(function(i,o){
            var option=options;
            if($(o).data('field')){
                option.field=$(o).data('field');
                option.id=$(o).data('id');
				option.info=$(o).data('info');
            }
            EditAble(o,option);
        });
    },
    'autoHeight':function(){
        this.keyup(function(){
            var minHeight=40;
            if(!$(this).attr('min-height')){
                minHeight=$(this).innerHeight();
                $(this).attr('min-height',minHeight);
            }else{
                minHeight=$(this).attr('min-height');
            }
            if($("#_hidetextarea").length<=0){
                $("body").append('<textarea id="_hidetextarea" style="visibility:hidden;height:0;border:0;padding:0;margin:0;display:none;"></textarea>');
            }
            var mh=$("#_hidetextarea");
            mh.css({display:'',width:$(this).width(),'fontSize':$(this).css('fontSize'),'lineHeight':$(this).css('lineHeight')}).val($(this).val());
            $(this).css("height",Math.max(minHeight,mh[0].scrollHeight));
            mh.css('display','none');
        });
    }
});

function tip(msg,stat,time){
    var types=['okay','warn','load','error','stop','info'];
    top.$.Tips({'text':msg||'正在提交','type':types[stat]||'load','time':time||0});
}

var regExps={
    'username':'[a-zA-Z_][0-9a-zA-Z_]{4,}',
    'loginname':'[0-9a-zA-Z\\.@_\\u0391-\\uFFE5]{4,}',
    'word':'[\\w\\d_]*',
    'word2':'[\\w\\d_\-]*',
    'email':'\\w+((-\\w+)|(\\.\\w+))*\\@[A-Za-z0-9]+((\\.|-)[A-Za-z0-9]+)*\\.[A-Za-z0-9]+',
    'zip':'[1-9]\\d{5}',
    'num':'(((\\+|-)?\d+(\\.\\d*)?)|((\\+|-)?(\\d*\\.)?\\d+))',
    'integer':'[-\\+]?(([1-9]{1}\\d*$)|(\\d{1})){1}',
    'double':'[-\\+]?\\d+(\\.\\d+)?',
    'money':'(([1-9]{1,3}(,)?)(\\d{3}(,)?){0,3})?(\\d{1,3})(\\.\\d{1,2})?',
    'en':'[A-Za-z]+',
    'cn':'[\\u4E00-\\u9FA5]+',
    'idcard':function(){
        return /^(\d{6}\d{2}[01]\d[0123][\d]\d{3}|\d{6}(19|20)\d{2}[01]\d[0123][\d]\d{3}[\dx])$/ig.test(this.value);
    },
    'max':function(){
        var l=$(this).attr('maxlength')||250,v=this.value;
        return v.length<=l;
    },
    'min':function(){
        var l=$(this).attr('minlength')||5,v=this.value;
        return v.length>=l;
    },
    'len':function(){
        var l = $(this).attr('length')||4;
        return l == this.value.length;
    },
    'equal':function(target){
        var f=this.form;
        if(f && f[target]){
            return f[target].value==this.value;
        }
    },
    'tel':'((\\(\\d{3}\\))|(\\d{3}\\-))?(\\(0\\d{2,3}\\)|0\\d{2,3}-)?[1-9]\\d{6,7}',
    'mobile':'((\\(\\d{2,3}\\))|(\\d{3}\\-))?1(3|5|8|9)\\d{9}',
    'qq':'[1-9]\\d{4,11}'
}



function verifyForm(f, issubmit){
    var $=jQuery;
    if(!$(f).attr('init')){
        jQuery.each(f.elements,function(){
            if(this.length){
                for (var i =0;i < this.length; i--) {
                    arguments.callee.call(this[i]);
                };
                return false;
            }
            if(this.type && /^(submit|reste|button)$/ig.test(this.type)) return;
            this.docheck=function(){
                var require=(!!this.getAttribute('required')),ck=this.getAttribute('check');
                if(this.value=='' && require){
                    var requiremsg='该项必须填写!';
                    if($(this).attr('requiretip'))requiremsg = $(this).attr('requiretip');
                    $(this).closeNotice().notice({msg:'<font class="errortip">'+requiremsg+'</font>'});
                    return false;
                }
                if(this.value!='' && ck){
                    var returnValue, errmsg;
                    var cks = ck.split(',,,');
                    for(var i=0;i<cks.length;i++){
                        ck = regExps[cks[i]]||cks[i];
                        if(ck.apply){
                            if(cks[i]=='equal'){
                                returnValue = ck.call(this,cks[i+1]);
                                i++;
                            }else{
                                returnValue = ck.call(this);
                            }
                        }else{
                            returnValue = (new RegExp('^'+ck+'$','ig')).test(this.value);
                        }
                        if(!returnValue){
                            errmsg = '该项格式不正确，请检查!';
                            if($(this).attr('tip'))errmsg = $(this).attr('tip');
                            $(this).closeNotice().notice({msg:errmsg});
                        }
                        return returnValue;
                    }
                }
                $(this).nextAll('font.errortip').remove();
                return true;
            }
            this.onblur=function(){
                var pass=this.docheck()
                if(pass){
                    $(this).removeClass('error').addClass('ok');
                    $(this).closeNotice();
                }else{
                    $(this).removeClass('ok').addClass('error');
                }
            }
        });
        $(f).attr('init','true')
    }
    if(window['tinymce'] && tinymce.triggerSave){
        tinymce.triggerSave();
    }
    if(issubmit===false){
        var func=arguments.callee;
        $(f).submit(function(e){
            e.preventDefault();
            try{
                func(f);
            }catch(e){}
            return false;
        });
        return;
    }
    if($(f).attr('submiting')){
        tip('请稍候,正在提交...');
        return false;
    }

    if($(f).attr('before')){
        try{
            var back=new Function('json',$(f).attr('before')).call(f);
            if(back===false){
                return false;
            }
        }
        catch(e){console.log(e)}
    }

    for(var i=0,l=f.elements.length;i<l;i++){
        if(f.elements[i].type && /^(submit|reset|button)$/ig.test(f.elements[i].type))continue;
        if(f.elements[i].docheck && !f.elements[i].docheck()){
            $(f.elements[i]).removeClass('ok').addClass('error').focus();
            return false;
        }
    }

    $(f).attr('submiting',1)
    tip('正在提交...');
    var method=f.method,action=f.action;

    action += (action.indexOf('?')>=0?'&':'?')+'tid='+new Date().getTime();
    $.ajax({
           'type':method.toUpperCase(),
           'url':action,
           'timeout':10000,
           'data':$(f).serialize(),
           'success':function(j){
			
               if(!j){
                   $(f).removeAttr('submiting');
                    tip('服务器返回数据格式错误',3,2);
                    return;
               }
                if(j.errorcode==0){
                    tip(j.message,0,2);
                    $(f.elements).removeClass('ok').removeClass('error');
                    $(f).removeAttr('submiting');
					//document.location.reload();
                }else{
                    tip(j.error||j.remsg||j.message||'验证失败',j.errorcode||3,2);
                    $(f).removeAttr('submiting');
                    if(j.field){
                        f[field] && $(f[field])[0].focus();
                    }
                }
                if($(f).attr('after')){
                    try{new Function('json',$(f).attr('after')).call(f,j);}
                    catch(e){console.log(e)}
                }
                if(j.script){
                    try{new Function('json',j.script).call(f,j);}
                    catch(e){console.log(e)}
                }
                if(j.url){
                    switch(j.url+''){
                        case '-1':
                        case 'back':
                        history.back();
                        break;
                        case '1':
                        case 'refresh':
                        location.reload();
                        break;
                        default:
                        location.href=j.url;
                    }
                }
            },
            'error':function(a, es, e){
                tip('服务器错误',3,2);
                $(f).removeAttr('submiting');
            },
            'dataType':'json'
    });
    return false;
}

if(!String.prototype.trim){
    String.prototype.trim = function() 
    { 
        return this.replace(/(^\s*)|(\s*$)/g, ""); 
    } 
    String.prototype.trimLeft = function() 
    { 
        return this.replace(/(^\s*)/g, ""); 
    } 
    String.prototype.trimRight = function() 
    { 
        return this.replace(/(\s*$)/g, ""); 
    }
}

function ajaxAction(lObj){
    if($(lObj).attr('actioning')){
        tip('请稍候,正在提交...');
        return false;
    }
    
    $(lObj).attr('actioning',1)
    tip('正在提交...');
    var action=$(lObj).attr('href');
    action += (action.indexOf('?')>=0?'&':'?')+'tid='+new Date().getTime();
    $.ajax({
           'type':'get',
           'url':action,
           'success':function(j){
               if(!j){
                   $(lObj).removeAttr('actioning');
                    tip('服务器返回数据格式错误',3,2);
                    return;
               }
                if(j.errorcode==0){
                    tip(j.message,0,2);
                    $(lObj).removeAttr('actioning');
                }else{
                    tip(j.error||j.message||'提交失败',3,2);
                    $(lObj).removeAttr('actioning');
                }
                if($(lObj).attr('after')){
                    try{new Function('json',$(lObj).attr('after')).call(lObj,j);}
                    catch(e){console.log(e)}
                }
                if(j.script){
                    try{new Function('json',j.script).call(lObj,j);}
                    catch(e){console.log(e)}
                }
                if(j.url){
                    switch(j.url+''){
                        case '-1':
                        case 'back':
                        history.back();
                        break;
                        case '1':
                        case 'refresh':
                        location.reload();
                        break;
                        default:
                        location.href=j.url;
                    }
                }
            },
            'error':function(a, es, e){
                tip('服务器错误',3,2);
                $(lObj).removeAttr('actioning');
            },
            'dataType':'json'
    });
    return false;
}

function EditAble(obj,options){
    var content=$(obj).find('.editcont');
    if(content.length<1){
        content=$('<div class="editcont">'+$(obj).html()+'</div>');
        $(obj).html('').append(content);
    }
    $(obj).append('<a href="javascript:" class="action">编辑</a><a href="javascript:" class="cancel">取消</a>');
    var action=$(obj).find('a.action');
    var cancel=$(obj).find('a.cancel');
	var allinfo=$(obj).data('info'); //完整
    var args=$.extend({
        id:$(obj).data('field'),
        field:$(obj).data('field'),
        action:$(obj).data('action'),
        mode:$(obj).data('mode')
    },options);
    $(obj).hover(function(){
        $(this).addClass('hover');
        $(this).find('.action,.cancel').css('opacity',1);
    },function(){
        $(this).removeClass('hover');
        $(this).find('.action,.cancel').css('opacity',.5);
    });
    action.click(function(e){
        e.preventDefault();
        e.stopPropagation();
        if($(obj).is('.saving'))return;
        if($(obj).is('.editing')){
            saveEdit();
        }else{
            startEdit();
        }
    });
    cancel.click(function(e){
        e.preventDefault();
        e.stopPropagation();
        cancelEdit();
    });
    function saveEdit(){
        if($(obj).is('.saving'))return;
        if($(obj).is('.editing')){
            $(obj).addClass('saving');
            args.currentContent=args.editfield.val();
            action.text('正在保存');
            $.ajax({
                url:args.action,
                type:'POST',
                data:'id='+parseInt(args.id)+'&'+encodeURIComponent(args.field)+
                    '='+encodeURIComponent(args.currentContent),
                dataType:'json',
                success:function(j){
                    action.text('编辑');
                    //
					location.reload();
                    //content.text(args.currentContent); 20140501 不需要预览
                    $(obj).removeClass('editing saving');
                }
            });
            
        }
    }
    function startEdit(){
        if($(obj).is('.saving') || $(obj).is('.editing'))return;
        $(obj).addClass('editing');
        action.text('保存');
        args.lastContent=content.text();
		args.allcontent=allinfo;
		if(args.allcontent==''){
			args.allcontent= args.lastContent; //针对截取字符，没有完整就调用截取
		}
        if(args.mode=='more'){
            args.editfield=$('<textarea />')
        }else{
            args.editfield=$('<input type="text" />')
        }
        $(args.editfield).css({

        });
        content.html('').append(args.editfield);
        args.editfield.val(args.allcontent); //赋值
    }
    function cancelEdit(){
        if($(obj).is('.saving'))return;
        if($(obj).is('.editing')){
            action.text('编辑');
            content.text(args.lastContent);
            $(obj).removeClass('editing');
        }
    }
}

//***********************************************/
//Fixed Image
//***********************************************/
function DrawImage(ImgD,w,h){
  var img = new Image();
    img.src = ImgD.src;
    var ow=img.width,oh=img.height,os=ow/oh,w=w||100,h=h||w,s=w/h;
    if(os>=s){
        if(ow > w){
            ImgD.style.width=w + 'px';
            ImgD.style.height=w/os + 'px';
            oh = w/os;
        }
    }else{
        if(oh > h){
            ImgD.style.height=h + 'px';
            ImgD.style.width=h*os + 'px';
            oh = h;
        }
    }
    if(oh < h){
        if(ow < w){
            ImgD.style.height=oh + 'px';
            ImgD.style.width=ow + 'px';
        }
        ImgD.style.marginTop=(h-oh)*.5+'px';
    }else{
        ImgD.style.marginTop='0px';
    }
}
function OverImage(o, w, h){
    if(!$.isNumeric(w)){
        var p=w||$(o).parent();
            h=p.height();
            w=p.width();
    }
    var img=new Image();
    img.src=o.src;
    var s=w/h,tw=img.width,th=img.height,ts=tw/th;
    if(ts>=s && th>=h){
        o.height=h;
        o.width=h*ts;
        $(o).css({marginLeft:(w-o.width)*.5});
    }else if(ts<=s && tw>=w){
        o.width=w;
        o.height=w/ts;
        $(o).css({marginTop:(h-o.height)*.5});
    }else{
        o.width=tw;
        o.height=th;
        $(o).css({marginTop:(h-o.height)*.5});
    }
}

(function(){
    var e=encodeURIComponent,d=document,s=screen,_share={
		
		tsina:function(title,url,pic,code,source,sourceurl){
            /*var f='http://v.t.sina.com.cn/share/share.php?appkey=',q=['&url=',e(url||d.location),'&title=',e(title||d.title),'&source=',e(source),'&sourceUrl=',e(sourceurl),'&content=',code||'utf-8','&pic=',e(pic||'')].join('');
            function a(){if(!window.open([f,q].join(''),'mb',['toolbar=0,status=0,resizable=1,width=440,height=430,left=',(s.width-440)/2,',top=',(s.height-430)/2].join('')))u.href=[f,q].join('')};
            if(/Firefox/.test(navigator.userAgent))setTimeout(a,0);else a()*/
        },
		
        tqq:function(title,url,pic,site,appkey){  //采用bshre插件
           /* var appkey=e(appkey||'');
            var site=e(site||'www.sokerr.com');
            var u='http://v.t.qq.com/share/share.php?title='+e(title||d.title)+'&url='+e(url||d.location)+'&appkey='+appkey+'&site='+site+'&pic='+e(pic||'');
            window.open(u,'','width=700, height=680, top=0, left=0, toolbar=no, menubar=no, scrollbars=no, location=yes, resizable=no, status=no')*/
        },
        
        qzone:function(url){
            window.open('http://sns.qzone.qq.com/cgi-bin/qzshare/cgi_qzshare_onekey?url='+e(url||d.location))
        },
		
        show:function(obj,title,url,pic,summary,i){
           /* var html=[
            '<a href="javascript:share.tsina(\''+title+'\',\''+url+'\',\''+pic+'\')" class="share sharetsina" title="分享到新浪微博"></a>',
            '<a href="javascript:share.tqq(\''+title+'\',\''+url+'\',\''+pic+'\')" class="share sharetqq" title="分享到腾讯微博"></a>',
            '<a href="javascript:share.qzone(\''+url+'\')" class="share shareqzone" title="分享到QQ空间"></a>',

            ];*/
				
			var html=[
            '<a href="javascript:bShare.share(event,\'sinaminiblog\','+i+');return false;" class="share sharetsina" title="分享到新浪微博"></a>',
            '<a href="javascript:bShare.share(event,\'qqmb\','+i+');return false;" class="share sharetqq" title="分享到腾讯微博"></a>',
            '<a href="javascript:bShare.share(event,\'mqzone\','+i+');return false;" class="share shareqzone" title="分享到QQ空间"></a>',
			'<a href="javascript:bShare.share(event,\'weixin\','+i+');return false;" class="share sharewechat" title="分享到微信朋友圈"></a>'
            ];
			
			var jshtml="<script> bShare.addEntry({title:'"+title+"', url:'"+url+"',pic:'"+pic+"',summary:'"+summary+"',})</script>";  //分享内容
            obj.html('<div class="sharebtnwrapper">'+html.join('')+'</div>'+jshtml);
		
        }
    };
    window.share=_share;
})();

function loadmore(link,target,node){
    if($(link).data('loading'))return;
    if(!node)node='dt';
    $(link).data('loading',1);
    $(link).text('正在加载...');
    var lastid=$(target+' '+node+':last').data('id');
    var lpre=$(link).data('link');
    $.ajax({
        url:(lpre?lpre:'')+'?lastid='+lastid,
        type:'get',
        success:function(h){
            $(link).data('loading',0);
            if(h.trim().length>10){
                $(target).append(h);
                if($(document.body).height()>5000){
                    $(link).text('加载更多>>');
                }else{
                    $(link).attr('onclick','');
                    $(link).attr('href',(lpre?lpre:'')+'?lastid='+lastid);
                    $(link).text('下一页>>');
                }
            }else{
                $(link).text('没有更多了');
                $(link).attr('onclick','');
            }
			icossetting();//加载分享内容
        },
        error:function(){
            $(link).data('loading',0);
            $(link).text('加载失败');
        }
    });
}